package com.midian.model.activity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.midian.common.utils.StringUtil;
import com.midian.model.common.BaseModel;

/**
 * 评论图片
 * 
 */
@Entity
@Table(name = "activity_comment_pic")
public class ActivityCommentPic extends BaseModel {
	/**评论id*/
	private String commentId;
	/**图片id*/
	private String picId;
	@ManyToOne(optional=true,fetch=FetchType.LAZY)
	@JoinColumn(name="commentId",insertable=false, updatable=false)
	@NotFound(action=NotFoundAction.IGNORE)
	private ActivityComment activityComment;
	
	

	public ActivityComment getActivityComment() {
		return activityComment;
	}

	public void setActivityComment(ActivityComment activityComment) {
		this.activityComment = activityComment;
	}

	public String getCommentId() {
		return commentId;
	}

	public void setCommentId(String commentId) {
		this.commentId = commentId;
	}

	public String getPicId() {
		return picId;
	}

	public void setPicId(String picId) {
		this.picId = picId;
	}
	
	/**活动封面图片地址*/
	@Transient
	public String getActivityCommentPicIp() {
		String activityCommentPicIp="";
		if (this.picId!=null) {
			activityCommentPicIp = StringUtil.getImageTips(this.picId);
		}
		return activityCommentPicIp;
		
	}
}
